home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / TVHOURS.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  1KB  |  29 lines

  1. ' TVHOURS.BAS
  2. ' This program uses DATA, READ, and RESTORE statements to track
  3. '   the number of TV hours viewed over a three-week time period.
  4.  
  5. CLS
  6.  
  7. PRINT "How many hours of TV did you watch during the last 3 weeks?"
  8. PRINT
  9.  
  10. FOR i% = 1 TO 3       ' for each of the last 3 weeks
  11.     FOR j% = 1 TO 7   '   and for each day in the week
  12.         READ day$                  ' read day name from DATA list
  13.         PRINT day$; ", Week"; i%;  ' prompt with day and week
  14.         INPUT "--> ", hours!       ' get TV hours for that day
  15.         totalHours! = totalHours! + hours!   ' total all the hours
  16.     NEXT j%
  17.     PRINT             ' print a blank line after each week
  18.     RESTORE           ' move data pointer to Monday for next iteration
  19. NEXT i%
  20.  
  21. PRINT "You watched";               ' display total number of hours
  22. COLOR 20                           '   in blinking red for fun
  23. PRINT totalHours!; "hours";
  24. COLOR 7                            ' return foreground color to white
  25. PRINT " of television during the last three weeks!"
  26.  
  27. DATA Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
  28.  
  29.